package 城市游戏;

import java.util.Scanner;

public class Main {

    static int N = 1010, n, m;
    static int[][] s = new int[N][N];
    static int[] l = new int[N];
    static int[] r = new int[N];
    static int[] q = new int[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                String ch = in.next();
                if (ch.equals("R")) {
                    s[i][j] = 0;
                } else {
                    s[i][j] = s[i - 1][j] + 1;
                }
            }
        }
        long res = 0;
        for (int i = 1; i <= n; i++) {
            res = Math.max(res, work(s[i]));
        }
        System.out.println(res);
    }

    private static long work(int[] h) {
        int tt = 0;
        for (int i = 1; i <= m; i++) {
            while (tt > 0 && h[q[tt]] >= h[i]) {
                tt--;
            }
            if (tt == 0) {
                l[i] = 0;
            } else {
                l[i] = q[tt];
            }
            q[++tt] = i;
        }
        tt = 0;
        for (int i = m; i >= 1; i--) {
            while (tt > 0 && h[q[tt]] >= h[i]) {
                tt--;
            }
            if (tt == 0) {
                r[i] = m + 1;
            } else {
                r[i] = q[tt];
            }
            q[++tt] = i;
        }
        long ret = 0;
        for (int i = 1; i <= n; i++) {
            ret = Math.max(ret, (r[i] - l[i] - 1) * h[i]);
        }
        return ret * 3;
    }
}
